<?php
session_start();
$login = $_SESSION['login'];
$privilegio = $_SESSION['privilegio'];

require_once($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/ClassesBasicas/Privilegio.php');
?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
        <link href="/Esquina_da_TI/default.css" rel="stylesheet" type="text/css" media="screen" />
        <script src="/Esquina_da_TI/js/jquery-1.3.2.js" type="text/javascript"></script>
        <script src="/Esquina_da_TI/js/exibirPaginas.js" type="text/javascript"></script>
        <script src="/Esquina_da_TI/js/tituloDinamico.js" type="text/javascript"></script>
        <title>Fórum</title>
    </head>
    <body>

        <!--CABEÇALHO-->
        <div id="header">
            <div id="menu">
                <ul id="main">
                    <li><a href="index.php"><img src="/Esquina_da_TI/images/home.png" class="menu"  title="Inicio" /><br/><b>Inicio</b></a></li>
                    <li><a href="/Esquina_da_TI/Gui/Forum.php"><img src="/Esquina_da_TI/images/forum.png" class="menu" title="Fórum"/><br/><b>Fórum</b></a></li>
                    <li><a href="javascript:exibirVerNoticia()"><img src="/Esquina_da_TI/images/noticia.png" class="menu" title="Noticia"/><br/><b>Notícias</b></a></li>
                    <li><a href="javascript:exibirVerArtigos()"><img src="/Esquina_da_TI/images/artigo.png" class="menu" title="Artigos"/><br/><b>Artigos</b></a></li>
                    <li><a href="/Esquina_da_TI/Gui/Downloads.php"><img src="/Esquina_da_TI/images/download.png" class="menu" title="Downloads"/><br/><b>Downloads</b></a></li>
                    <li><a href="/Esquina_da_TI/Gui/CadastroUsuario.php"><img src="/Esquina_da_TI/images/Cadastro.png" class="menu" title="Cadastro"/><br/><b>Cadastro</b></a></li>
                    <li><a href="/Esquina_da_TI/Gui/OportunidadeEmprego.php"><img src="/Esquina_da_TI/images/oportunidade.png" class="menu" title="Empregos"/><br/><b>Empregabilidade</b></a></li>
                    <li><a href="javascript:exibirFaleConosco()"><img src="/Esquina_da_TI/images/faleconosco.png" class="menu" title="Fale Conosco"/><br/><b>Fale Conosco</b></a></li>
                    <li><a href="javascript:favoritos()"><img src="/Esquina_da_TI/images/addFavoritos.png" class="menu" title="Add Favoritos"/><br/><b>Favoritos</b></a></li>
                </ul>
            </div>
            <div id="logo">
                <h1><a href="#"><span>Esquina da T.I.</span></a></h1>
                <p>a Tecnologia a seu alcance</p>
            </div>
        </div>
        <div id="wrapper">
            <div id="page">
                <div id="sidebar2" class="sidebar">
                    <?php

                    if (isset ($_SESSION['login'])) {
                        echo " <div id='loginForum'>";
                        echo  "<b><font color =  '#FF7F00'>".$_SESSION['privilegio'] ." >>> </font>". " <font color='#0066ff'>"  . $_SESSION['login']."</font></b></div>";
                        echo " <div id='logoffForum'>";
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        echo "<a href='MinhaConta.php'><img src='/Esquina_da_TI/images/minhaConta.png'/></a>";
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        echo "<a href='logoff.php'><img src='/Esquina_da_TI/images/logoff.png'/></a>";
                        echo"<br>";
                        echo "<a href='MinhaConta.php'><b><font color='#0066ff'>Minha Conta </font></b></a>";
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        echo "<a href='logoff.php'><b><font color='#0066ff'>Logoff</font></b></a>";
                    }
                    else {
                        echo " <div id='loginForum'>";
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        echo "<a href='EfetuarLogin.php'><img src='/Esquina_da_TI/images/login.png'/></a><br>";
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                        echo "<a href='EfetuarLogin.php'><b><font color='#0066ff'>Fazer Login</font></b></a><br>";
                        echo "<font color =  '#FF7F00'>";
                        echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
                    
                    ?>

                    <script language="JavaScript">

                        <!--
                        var d = new Date()
                        var h = d.getHours()

                        if (h < 12)
                            document.write("Bom-dia ! ")
                        else
                            if (h < 18)
                                document.write("Boa-tarde ! ")
                        else
                            document.write("Boa-noite ! ")
                        // -->
                    </script>

                    <?php
                    echo "<b>&nbsp;&nbsp;Visitante</b></font><br>";

                    }

                    echo "</div>";
                    echo "</div>";
                    ?>

                    <br>
                    <br>
                    <br>
                    <a href='/Esquina_da_TI/Gui/Forum.php'><font style="text-align:left" size="5px" color="Red">Indice dos Foruns</font></a>



                    <!--CONTEUDO DO CENTRO-->

                    <div align="center" style="border:double">
                        <div class="post" align="center">
                            <form name='forum' method='post' action=''>
                                <table class="forum" cellspacing="1" cellpadding="1">
                                    <tr>
                                        <td width="2%" class="head"></td>
                                        <td width='30%' class="head" colspan="2">Foruns</td>
                                        <td width='6%' class="head" colspan="2">Assuntos</td>
                                        <td width='6%' class="head" colspan="2">Topicos</td>
                                        <td width='55%' class="head" colspan="2">Ultimo Topico</td>
                                    </tr>

                                    <?php
                                    require_once($_SERVER["DOCUMENT_ROOT"] . '/Esquina_da_TI/Gui/Fachada.php');
                                    $fachada = new Fachada();
                                    $foruns = $fachada->listarForuns();

                                    foreach($foruns as $f) {
                                        $titulo = $f['titulo'];
                                        $qtdAssuntos = $f['assuntos'];
                                        $qtdTopicos = $f['topicos'];
                                        $ultimoTopico = $f['ultimoTopico'];
                                        echo "<tr>";
                                        //echo "<td class='forumNum'><img src='/Esquina_da_TI/images/foruns.jpg'/></td>";
                                        echo "<td class='forumNum'><img src='/Esquina_da_TI/images/forum.png'/></td>";
                                        echo "<td class='forum' colspan='2'><a href='exibirAssuntos.php?forum=$titulo'>"  . $titulo . "</a></td>";
                                        echo "<td class='forumNum' colspan='2'>".$qtdAssuntos."</td>";
                                        echo "<td class='forumNum' colspan='2'>".$qtdTopicos."</td>";
                                        echo "<td class='forumNum' colspan='2'>".$ultimoTopico."</td>";
                                        echo "</tr>";
                                    }
                                    ?>
                                </table>
                            </form>
                        </div>
                        <a href="/Esquina_da_TI/index.php"><font color="blue"><<<&nbsp;Voltar</font></a>
                        <br><br>
                    </div>

                </div>
                <!--BARRA DO RODAPÉ-->
                <div style="clear: both;">&nbsp;</div>
            </div>
        </div>

        <!--RODAPÉ-->
        <div id="footer">
            <p class="copyright">&copy;&nbsp;&nbsp;2009 All Rights Reserved &nbsp;&bull;&nbsp; Design by <a href="#">H1 Softwares</a>.</p>
            <p class="link"><a href="#">Privacy Policy</a>&nbsp;&#8226;&nbsp;<a href="#">Terms of Use</a></p>
        </div>
    </body>
</html>
